<div id="channel_tb">
	<#--<a href="#" onclick="add()" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">添加</a>-->
	<#--<a href="#" onclick="edit()" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true">编辑</a>-->
	<#--<a href="#" onclick="del()" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true">删除</a>-->
	<a href="#" onclick="search()" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true">查看</a>
</div>
<table id="channel_dg"></table>
<div id="channel_form"></div>
<#include "/WEB-INF/views/include/common.ftl"/>
<script>
	var channel_dg;
	$(function() {
		channel_dg = $('#channel_dg');
		channel_dg.datagrid({
			url: '${ctx}/offer/payChannelList/${channelId}',
			fitColumns: true,
			pagination: true,
			rownumbers:true,
			pageSize: 10,
            singleSelect: true,
			pageList: [10, 20, 30],
			columns: [
				[{
					field:'id',
					title:'id',
					width:100,
                    hidden:true

				}, {
					field: 'productName',
					title: '产品名称',
					width: 100
				},{
					field: 'payScene',
					title: '支付场景',
					width: 100
                    },{
					field: 'deviceName',
					title: '设备',
					width: 100,
                    formatter: function(value,row,index){
                        console.info(value);
                        var res = "";
                        if(value == 1){
                            res = "移动端"
                        }else if(value == 2){
                            res == "PC"
                        } else {
                            res = "其他"
                        }
                        return res;
                    }
				},{
					field: 'offerType',
					title: '报价方式',
					width: 100,
                    formatter: function(value,row,index){
                        var res = "";
                        if(value == 1){
                            res = "固定按单"
                        }else if(value == 2){
                            res == "固定比例"
                        } else if(value == 3){
                            res = "阶梯按单"
                        } else if(value == 4){
							res = "阶梯比例"
						}
                        return res;
                    }
				}, {
					field: 'offerPrice',
					title: '恒生价格',
					width: 100
				}, {
					field: 'offerPartyPrice',
					title: '第三方价格',
					width: 100
				}, {
					field: 'fengding',
					title: '封顶',
					width: 100,
                    formatter: function(value,row,index){
                        return value == null ? "无" : value;
                    }
				}, {
					field: 'fengdi',
					title: '封底',
					width: 100,
                    formatter: function(value,row,index){
                        return value == null ? "无" : value;
                    }
				}, {
					field: 'accountTime',
					title: '清算周期',
					width: 100,
                    formatter: function(value,row,index){
                        return value == null ? "无" : "Ｔ＋"+value;
                    }
				},{
					field: 'conditions',
					title: '接入条件',
					width: 100,
                    formatter: function(value,row,index){
                        return value == null ? "无" : value;
                    }
				},{
					field: 'supportBank',
					title: '支持银行',
					width: 100
				}]
			],
			toolbar: '#channel_tb'
		});
	});

	<!--添加方法-->
	function add() {
		parent.$.modalDialog.openner = channel_dg;
        parent.$.modalDialog({
			title: "添加渠道信息",
			width: 800,
			height: 400,
			href: "${ctx}/offer/addChannelUI/${channelId}"
		});
	}

    <!--删除方法-->
    function del(){
        var row = channel_dg.datagrid("getSelected");
        if(row == null){
            $.messager.show({
                title : '提示信息',
                msg : '请选择一条记录',
                timeout : 1000 * 2
            });
            return false;
        }
        $.get("${ctx}/offer/delChannel/"+row.id,function(data){
            channel_dg.datagrid("reload");
            $.messager.show({
                title : '提示信息',
                msg : '操作成功',
                timeout : 1000 * 2
            });
        })
    }

</script>